{template 'common/header'}
<meta charset="utf-8" />
<link rel="stylesheet" href="../addons/qqbb_ppp/css/webstyle.css" type="text/css" />
<link rel="stylesheet" href="../addons/qqbb_ppp/css/notice.css" type="text/css" />
<script type="text/javascript" src="../addons/qqbb_ppp/js/notice.js" ></script>

<div class="main">
	<ul class="nav nav-tabs">
		<li {if $op == 'all'} class="active" {/if}>
			<a href="{php echo $this->createWebUrl('guanli',array('op' =>'all'));}">语录管理</a>
		</li>
		<li {if $op == 'edit'} class="active" {/if}>
			<a href="{php echo $this->createWebUrl('guanli',array('op' =>'edit'));}">语录修改</a>
		</li>

	</ul>
	{if $op == 'all'}
	<div class="panel panel-info">
		<div class="panel-heading">经典语录</div>
		<div class="panel-body">
			<div class="sort" id="syssort">
				<div class="sort-tit" style="">
					<table class="table table-hover">
						<thead class="navbar-inner">
							<tr style="border-bottom: 3px solid #66CCFF;">
								<th class="th2"  style="text-align: center;">序号</th>
								<th class="th3">语录</th>												
								<th class="th6" style="text-indent: 20px;">操作</th>						
							</tr>
						</thead>
					{loop $list $con}
					<tr style="border-bottom: 3px solid #66CCFF;">
						<td style="text-align: center;"></td>
						<td>{$con['words']}</td>						
						<td>
							<a href="{php echo $this->createWebUrl('guanli',array('op'=>'edit','consid'=>$con['id'],'words'=>$con['words']))}"><span class="label label-success">修改</span></a>
							<a class="dellist" this_id="{$con['id']}" style="cursor: default;"><span class="label label-danger">删除</span></a>
						</td>
					</tr>
					{/loop}
					</table>	
					
				</div>
			</div>
		</div>
	</div>
	{/if}
	{if $op == 'edit'}
	<div class="main">
	<div class="panel panel-info" id="xiugai">
		<div class="panel-heading">修改语录</div>
		<div class="panel-body">
			<form action="" method="post" class="form-horizontal" role="form">
				<input type="hidden" name="c" value="site" />
				<input type="hidden" name="a" value="entry" />
				<input type="hidden" name="m" value="qqbb_ppp" />
				<input type="hidden" name="do" value="guanli" />
				<input type="hidden" name="op" value="all" />
				<input type="hidden" name="words_id" value="{$_GPC['consid']}" />

				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">语录内容</label>
					<div class="col-xs-12 col-sm-8 col-lg-9">
						<input type="text" name="words" id="words" value="{$_GPC['words']}" class="form-control">
					</div>
				</div>
				<div class="form-group col-sm-12 finish">			
					<button class="label label-success searchs" id="edits">修改</button>
				</div>
			</form>
		</div>	
		</div>

</div>
{/if}

</div>
<script>
	function message(msg){
        require(['util'],function(){
            util.message(msg);
        })
  }
	$('#edits').click(function(){
		var yulu = $('#words').val();
		if(yulu == null || yulu == ''){
			showNoticeFunc('新.睿.社.区.提.示:语录不能为空！');
			return false;
		}
	})
</script>
		<script>
//			---序号---
			$(function(){
		        //$('table tr:not(:first)').remove();
		        var len = $('table tr').length;
		        for(var i = 1;i<len;i++){
		            $('table tr:eq('+i+') td:eq(0)').text(i);
		        }		            
			});

		</script>
		<script>
			function message(msg){
		        require(['util'],function(){
		            util.message(msg);
		        })
		    }
			//删除			
			$('.dellist').click(function() {
				var conid = $(this).attr('this_id');
				var msg = '您确定要删除该语录吗?';
				if(confirm(msg)) {
					$.post("{php echo $this->createWebUrl('guanli')}", { id: conid }, function() {
						showNoticeFunc('该语录删除成功！');
						window.location.reload();
					});
				}
			});

		</script>
{template 'common/footer'}